package com.bitmap.mysqlite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class MySQLite extends SQLiteOpenHelper {

	public MySQLite(Context context, int version) {
		super(context, "person.db", null, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String sql = "CREATE TABLE person(id INTEGER PRIMARY KEY AUTOINCREMENT, uid varchar(20), photo BINARY)";
		db.execSQL(sql);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		if(newVersion > oldVersion){
	        db.execSQL("DROP TABLE IF EXISTS[person]");
	    } else {
	        return;
	    }
	    onCreate(db);
	}

}
